SSR and SPA (1/5)
What is SSR and how does SvelteKit implement it?

    SSR, or Server-Side Rendering, is the process of generating the HTML of a web page on the server instead of in the browser. This allows the client to receive fully rendered HTML, improving performance, SEO, and initial load times.

    SvelteKit automatically supports SSR by rendering `+page.svelte` and `+layout.svelte` components on the server during the initial request. It also allows hydration on the client so that interactivity is preserved, giving the user a seamless experience.

    Example: SSR with load()
    Example: Using Data in +page.svelte
    Best practices and behaviors:
    • SSR renders HTML on the server for faster initial load and better SEO.
    • SvelteKit automatically hydrates the page on the client to make it interactive.
    • You can fetch data on the server using `load()` in `+page.js` or `+layout.js`.
    • Endpoints (`+server.js`) can be used to provide data to SSR pages.
    • Hybrid rendering is possible: some pages can be fully server-rendered, others client-only.